#!ipxe

:live_menu
set os Manjaro
menu ${os} Live
set ipparam BOOTIF=${netX/mac} ip=dhcp net.ifnames=0
item --gap ${os} Live versions
item current ${space} ${os} Current Stable (21.x)
choose menu || goto live_exit
goto ${menu}

:current
menu ${os} Live Current
item --gap ${os} Versions
{% for key, value in endpoints.items() | sort %}
{% if value.os == "manjaro" and value.version == "current" %}
item {{ value.version }}-{{ value.flavor }} ${space} ${os} {{ value.version }} {{ value.flavor }}
{% endif %}
{% endfor %}
choose version || goto live_menu
goto ${version}

{% for key, value in endpoints.items() | sort %}
{% if value.os == "manjaro" and value.version == "current" %}
:{{ value.version }}-{{ value.flavor }}
set fetch_url ${live_endpoint}{{ value.path }}
set kernel_url ${live_endpoint}{{ value.path }}
goto boot
{% endif %}
{% endfor %}

:boot
imgfree
kernel ${kernel_url}vmlinuz misobasedir=manjaro ${ipparam} miso_http_srv=${fetch_url} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 driver=free tz=UTC lang=en_US keytable=us {{ kernel_params }}
initrd ${kernel_url}initrd
boot

:live_exit
clear menu
exit 0
